package com.example.rubbish.Ui;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.rubbish.R;


public class SearchIcon extends androidx.appcompat.widget.AppCompatButton {

    //左侧搜索图标
    private Drawable searchDrawable;



    public SearchIcon(@NonNull Context context) {
        super(context);
        init();
    }

    public SearchIcon(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public SearchIcon(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    /**
     * void init()
     * 初始化图标资源
     */


    private void init() {
        searchDrawable = getResources().getDrawable(R.drawable.searchicon);
        //设置左侧搜索图标
        setCompoundDrawablesWithIntrinsicBounds(searchDrawable,
                null, null, null);
    }
}
